package collectionandmap;

import java.util.HashMap;
import java.util.Map;

public class HashMapTest {

	public static void main(String[] args) {
		Map<KeyBean, String> map = new HashMap<>();
		KeyBean k1 = new KeyBean(1, "foo");
		String s1 = "foo";
		map.put(k1, s1);
		
		KeyBean k2 = new KeyBean(1, "Boo");
		String s2 = "Boo";
		map.put(k2, s2);
		
		System.out.println(k1.hashCode());//1
		System.out.println(k2.hashCode());//1
		
		KeyBean k3 = new KeyBean(3, "Zoo");
		String s3 = "Zoo";
		map.put(k3, s3);
		System.out.println(k3.hashCode());//3

		System.out.println(map.size());//2
		System.out.println(map.get(k1));//Boo
		System.out.println(map.get(k2));//Boo
		System.out.println(map.get(k3));//Zoo
	}

}
